/* 全局样式变量 */
:root {
  --primary-color: #409eff;
  --success-color: #67c23a;
  --warning-color: #e6a23c;
  --danger-color: #f56c6c;
  --info-color: #909399;

  --text-primary: #303133;
  --text-regular: #606266;
  --text-secondary: #909399;
  --text-placeholder: #c0c4cc;

  --border-light: #ebeef5;
  --border-lighter: #f2f6fc;
  --border-extra-light: #fafafa;

  --fill-light: #f5f7fa;
}

/* 暗色主题变量 */
.dark {
  --primary-color: #409eff;
  --success-color: #67c23a;
  --warning-color: #e6a23c;
  --danger-color: #f56c6c;
  --info-color: #909399;

  --text-primary: #e5eaf3;
  --text-regular: #cfd3dc;
  --text-secondary: #a3a6ad;
  --text-placeholder: #6c6e72;

  --border-light: #4c4d4f;
  --border-lighter: #414243;
  --border-extra-light: #363637;

  --fill-light: #2a2a2b;
}

/* 通用工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-column {
  display: flex;
  flex-direction: column;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

/* 卡片样式 */
.stats-card {
  .el-card__body {
    padding: 24px;
  }

  .stat-content {
    display: flex;
    align-items: center;

    .stat-icon {
      width: 64px;
      height: 64px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 16px;

      .el-icon {
        font-size: 32px;
      }
    }

    .stat-info {
      flex: 1;

      .stat-value {
        font-size: 28px;
        font-weight: 600;
        line-height: 1;
        margin-bottom: 8px;
        color: var(--el-text-color-primary);
      }

      .stat-title {
        font-size: 14px;
        color: var(--el-text-color-regular);
        margin-bottom: 4px;
      }

      .stat-trend {
        font-size: 12px;
        display: flex;
        align-items: center;

        &.up {
          color: var(--success-color);
        }

        &.down {
          color: var(--danger-color);
        }

        .el-icon {
          margin-right: 4px;
        }
      }
    }
  }
}

/* 图表容器样式 */
.chart-container {
  height: 300px;
  width: 100%;

  .chart {
    height: 100%;
    width: 100%;
  }
}

/* 响应式网格 */
.responsive-grid {
  display: grid;
  gap: 16px;

  &.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
  &.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  &.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  &.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

  @media (max-width: 1200px) {
    &.grid-cols-4 { grid-template-columns: repeat(3, 1fr); }
    &.grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  }

  @media (max-width: 768px) {
    &.grid-cols-4,
    &.grid-cols-3,
    &.grid-cols-2 { grid-template-columns: repeat(1, 1fr); }
  }
}

/* 加载状态 */
.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex-direction: column;

  .loading-text {
    margin-top: 16px;
    color: var(--el-text-color-regular);
  }
}

/* 空状态 */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex-direction: column;

  .empty-icon {
    font-size: 48px;
    color: var(--el-text-color-placeholder);
    margin-bottom: 16px;
  }

  .empty-text {
    color: var(--el-text-color-secondary);
    font-size: 14px;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--el-bg-color-page);
}

::-webkit-scrollbar-thumb {
  background: var(--el-border-color-darker);
  border-radius: 3px;

  &:hover {
    background: var(--el-border-color-dark);
  }
}

/* Element Plus 样式覆盖 */
.el-card {
  border-radius: 8px;
  border: 1px solid var(--el-border-color-lighter);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);

  .el-card__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--el-border-color-lighter);

    .card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;

      .title {
        font-size: 16px;
        font-weight: 600;
        color: var(--el-text-color-primary);
      }
    }
  }
}

.el-table {
  .el-table__header-wrapper {
    th {
      background-color: var(--el-fill-color-light);
    }
  }
}

.el-button {
  border-radius: 6px;
}

.el-input {
  .el-input__inner {
    border-radius: 6px;
  }
}

.el-select {
  .el-input {
    .el-input__inner {
      border-radius: 6px;
    }
  }
}